import java.io.FileInputStream;
import java.io.FileNotFoundException;

import java.util.Scanner;


public class task5 {

	public static void main(String[] args) throws FileNotFoundException {
		
		String word , search;
		int frq = 0;
		
		FileInputStream input = new FileInputStream("input5.txt");
		
		Scanner sc = new Scanner(input);
		Scanner scc = new Scanner(System.in);
		
		sc.useDelimiter("[ \n\t\r?:.,;!]+");
		
		System.out.print("Enter the word:");
		search = scc.next();
		
		do {
			
			word = sc.next();
			
			if((word.indexOf(search))!=-1)
					frq++;
			
		}while(sc.hasNext());
		
		System.out.println("The frequency of "+search+" is "+frq);
	
		
		sc.close();
		scc.close();
		
	}

}
